.size() {
  width: 100%;
  height: 100%;
}

.op-icon() {
  width: 44px;
  height: 44px;
  font-size: 24px;
  color: #fff;
  background-color: #606266;
  border-color: #fff;
}

.@{gx-prefix}-image {
  position: relative;
  display: inline-flex;
  overflow: hidden;

  &-inner {
    .size();
    vertical-align: top;

    &.gx-image-inner-center {
      position: relative;
      top: 50%;
      left: 50%;
      display: block;
      transform: translate(-50%, -50%);
    }
  }

  &-placeholder {
    .size();
    background: #f5f7fa;
  }

  &-error {
    display: flex;
    align-items: center;
    justify-content: center;
    .size();
    font-size: 14px;
    color: #c0c4cc;
    vertical-align: middle;
    background: #f5f7fa;
  }

  &-preview {
    cursor: pointer;
  }
}

.@{gx-prefix}-image-viewer {
  &-group-item {
    cursor: pointer;
  }

  &-wrapper {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }

  &-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 0.5;
  }

  &-btn {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    border-radius: 50%;
    opacity: 0.8;
  }

  &-close {
    top: 40px;
    right: 40px;
    width: 40px;
    height: 40px;
    font-size: 40px;
    .op-icon();
  }

  &-canvas {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }

  &-actions {
    bottom: 30px;
    left: 50%;
    width: 282px;
    height: 44px;
    padding: 0 23px;
    background-color: #606266;
    border-color: #fff;
    border-radius: 22px;
    transform: translateX(-50%);

    &-inner {
      display: flex;
      align-items: center;
      justify-content: space-around;
      width: 100%;
      height: 100%;
      font-size: 23px;
      color: #fff;
      text-align: justify;
      cursor: default;
    }
  }

  &-prev {
    top: 50%;
    left: 40px;
    transform: translateY(-50%);
    .op-icon();
  }

  &-next {
    top: 50%;
    right: 40px;
    text-indent: 2px;
    transform: translateY(-50%);
    .op-icon();
  }
}

.viewer-fade-enter-active {
  animation: viewer-fade-in 0.3s;
}

.viewer-fade-leave-active {
  animation: viewer-fade-out 0.3s;
}

@keyframes viewer-fade-in {
  0% {
    opacity: 0;
    transform: translate3d(0, -20px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes viewer-fade-out {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -20px, 0);
  }
}
